#include <functional>
#include <iostream>

//C++ 11 回调函数用法

class Foo{
public:
    void bar(int i){
        std::cout<<"get:"<<i<<std::endl;
    }
};

int main(){
    Foo foo;
    std::function<void(int)> callback;
    callback = std::bind(&Foo::bar,&foo,std::placeholders::_1);
    callback(1);
    callback(2);
    return 0;
}
